import { modal } from 'vue-strap'
import { showMsg } from '../../../../../vuex/action.js'

export default {
  data() {
    return {
      showAddInverstorModal: false,
      portfolio: {
        id: '',
        name: '',
        descr: '',
        labels: '',
        betaType: '',
        proDesc: '',
        prospect: '',
        riskLevel: '',
        file: '',
        investerName: '',
        investerOrg: '',
        investerCardNum: '',
        investerId: '',
        investerImg: '',
        isNew: 0,
        isTransferAllow: 0,
        isBuyAllow: 0,
        isHomepage: 0,
        status: 0,
      }
    }
  },
  methods: {
    evtAddInverstor() {
      this.showAddInverstorModal = true
    },
    trim(inStr) {
      return inStr.replace(/(^ +)|( +$)/g, '')
    },
    checkValid() {
      if (this.id.length === 0) {
        return '请输入组合ID'
      } else if (this.name.length === 0) {
        return '请输入组合名称'
      } else if (this.descr.length === 0) {
        return '请输入组合描述'
      }
    },
    addInverstorInfo() {
      let validMsg = this.checkValid()
      if (validMsg) {
        return this.xShowMsg({
          type: 'danger',
          content: validMsg
        })
      }

    // let formData = new FormData()
    // let imageFile = this.$els.portfolioImg.files[0]
    // formData.append('name', this.name)
    // formData.append('img', this.$els.addImage.files[0])
    // formData.append('org', this.org)
    // formData.append('cardNum', this.cardNum)
    // this.xAddInverstorInfo(formData)
    //   .then((res) => {
    //    this.showAddMoneyTypeModal = false
    //  })
    }
  },
  components: {
    modal: modal
  },
  vuex: {
    actions: {
      xShowMsg: showMsg
    }
  }
}
